package no.ntnu.idi.deid.patternmatching.search.dictionary.lucene;

import java.io.Reader;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.core.LowerCaseFilter;
import org.apache.lucene.util.Version;
import org.apache.lucene.util.AttributeSource.AttributeFactory;

public class NewLineAnalyzer extends Analyzer {

	Version version;
	
	public NewLineAnalyzer(Version lucene41) {
		this.version = lucene41;
	}

	@Override
	protected TokenStreamComponents createComponents(String arg0, Reader reader) {
		NewLineTokenizer tokenizer = new NewLineTokenizer(version,AttributeFactory.DEFAULT_ATTRIBUTE_FACTORY, reader);
		TokenStream lowerCasefilter = new LowerCaseFilter(version, tokenizer);
		return new TokenStreamComponents(tokenizer, lowerCasefilter);
	}

}
